Tumor=$1

for phi in `seq 2 4`
do
for cluster in `seq 1 3`
do
purity=`cat ${Titan_path}/allModel/All_allModel_params.tsv  | grep -w ${Tumor} | \
awk -F'\t' '{if($1==ploidy && $2~cluster )print }' ploidy=${phi} cluster=${cluster} | \
awk -F'\t' '{print $4}'`
ploidy=`cat ${Titan_path}/allModel/All_allModel_params.tsv  | grep -w ${Tumor} | \
awk -F'\t' '{if($1==ploidy && $2~cluster )print }' ploidy=${phi} cluster=${cluster} | \
awk -F'\t' '{print $5}'`

mkdir -p ${Titan_path}/CNAPlot/${Tumor}_titanCNA_ploidy${phi}/${Tumor}_cluster${cluster}

${titianCNA_rscript} ${scripts_path}/TitanCNA_PlotCNA.grch37.R \
--work_path ${Titan_path}/hmm/${Tumor}_titanCNA_ploidy${phi} \
--out_path ${Titan_path}/CNAPlot/${Tumor}_titanCNA_ploidy${phi}/${Tumor}_cluster${cluster} \
--id ${Tumor} --ploidy ${ploidy} --purity ${purity} \
--phi ${phi} --numClustersStr ${cluster} 

done
done